Skip to main content

All Questions

3votes
5answers
300views

How do you force developers to define dependencies/arguments if it's bad to put the constructor function in the interface?

I just started reading more about OOP and its design patterns and is confused with this conceptual question. I am too new that I am having second thought that the proper title should be, "when is it ...
arvil's user avatar
1vote
1answer
618views

Should the function that operates on the object return it?

Should the function that operates on the object return it? Shortened example: class Example1 { public function method($a, $b) { $result = new Result($a, $b); $this->...
sihay's user avatar
25votes
2answers
18kviews

Exceptions in DDD

I'm learning DDD and I'm thinking about throwing exceptions in certain situations. I understand that an object can not enter to a bad state so here the exceptions are fine, but in many examples ...
yadiv's user avatar
1vote
1answer
126views

Should "magic" getter functions be used for dynamically calculated values or just existing properties?

For example, if I had a Customer class and wanted to get all orders by them. Would it be better to do: class Customer{ public function getOrders(){ return results from db query } } .....
Cal7's user avatar
  • 377
2votes
2answers
10kviews

In PHP, should I delete objects immediately after use?

I've read in PHP Advanced and Object Oriented Programming by Larry Ullman that it is good programming practice to delete object immediately after use but reason is given nowhere. I am a student web ...
user avatar
3votes
3answers
1kviews

Is there a limit on how many global consts are used before an application is considered bad programming?

Basically, I develop websites, some large with many crud operations, etc... However I've gotten into the habit of storing re-usable data as a constant in my PHP applications I currently have 44 ...
AlexMorley-Finch's user avatar

close